
#ifndef __HOOK_KERNEL_H__
#define __HOOK_KERNEL_H__
#include "base.h"

int Hook_KernelBase();
int UnHook_KernelBase();

BOOL WINAPI HOOK_CreateProcessInternalW(
    HANDLE hToken,
    LPCWCH lpApplicationName,
    LPCWCH lpCommandLine,
    LPSECURITY_ATTRIBUTES lpProcessAttributes,
    LPSECURITY_ATTRIBUTES lpThreadAttributes,
    BOOL bInheritHandles,
    ULONG dwCreationFlags,
    LPCWCH lpEnvironment,
    LPCWCH lpCurrentDirectory,
    LPVOID lpStartupInfo,
    LPPROCESS_INFORMATION lpProcessInformation,
    HANDLE* hNewToken);

typedef BOOL (WINAPI* PFN_CreateProcessInternalW)(
    HANDLE hToken,
    LPCWCH lpApplicationName,
    LPCWCH lpCommandLine,
    LPSECURITY_ATTRIBUTES lpProcessAttributes,
    LPSECURITY_ATTRIBUTES lpThreadAttributes,
    BOOL bInheritHandles,
    ULONG dwCreationFlags,
    LPCWCH lpEnvironment,
    LPCWCH lpCurrentDirectory,
    LPVOID lpStartupInfo,
    LPPROCESS_INFORMATION lpProcessInformation,
    HANDLE* hNewToken);
extern PFN_CreateProcessInternalW REAL_CreateProcessInternalW;

BOOL WINAPI HOOK_DeviceIoControl(
    _In_ HANDLE hDevice,
    _In_ DWORD dwIoControlCode,
    _In_reads_bytes_opt_(nInBufferSize) LPVOID lpInBuffer,
    _In_ DWORD nInBufferSize,
    _Out_writes_bytes_to_opt_(nOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
    _In_ DWORD nOutBufferSize,
    _Out_opt_ LPDWORD lpBytesReturned,
    _Inout_opt_ LPOVERLAPPED lpOverlapped
);

typedef BOOL (WINAPI* PFN_DeviceIoControl)(
    _In_ HANDLE hDevice,
    _In_ DWORD dwIoControlCode,
    _In_reads_bytes_opt_(nInBufferSize) LPVOID lpInBuffer,
    _In_ DWORD nInBufferSize,
    _Out_writes_bytes_to_opt_(nOutBufferSize, *lpBytesReturned) LPVOID lpOutBuffer,
    _In_ DWORD nOutBufferSize,
    _Out_opt_ LPDWORD lpBytesReturned,
    _Inout_opt_ LPOVERLAPPED lpOverlapped
);
extern PFN_DeviceIoControl REAL_DeviceIoControl;

#endif